package senior.DateExer;

import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * 输出今年的星期天都是几号
 *
 * @author shkstart
 * @creat 2022-04-16:09
 */
public class Exer4 {
    public static void main(String[] args) {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd E");
        cal.set(Calendar.DAY_OF_YEAR, 1);
        for (int i = 0; i < 365; i++) {

            if (cal.get(Calendar.DAY_OF_WEEK) == 1 && cal.get(Calendar.YEAR) == 2022) {
                System.out.println(sdf.format(cal.getTime()));

            }
            cal.add(Calendar.DATE, 1);
        }


    }
}
